<?php
namespace app\api\controller;

use app\service\QueueService;

class Queue
{
    protected $queueService;

    public function __construct()
    {
        $this->queueService = new QueueService();
    }

    // 取号
    public function getNumber()
    {
        $number = $this->queueService->getNumber();
        return json(['code' => 200, 'message' => '取号成功', 'number' => $number]);
    }

    // 叫号
    public function callNumber()
    {
        $number = $this->queueService->callNumber();
        return json(['code' => 200, 'message' => '叫号成功', 'number' => $number]);
    }

    // 查看当前排队状态
    public function getQueueStatus()
    {
        $status = $this->queueService->getQueueStatus();
        return json(['code' => 200, 'message' => '获取成功', 'status' => $status]);
    }
}
